<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
<script type="text/javascript">
	$(function(){
		
		new S.AutoComplete({
			el:'#project_owner',
			url:'${webcontext}/${pathvar.admin}/user/search',
			render:function(data){
				return '<b>'+data.realName+'</b> <span>'+data.orgName+'</span>';
			},
			click:function(data){
				$('#project_owner').val(data.realName+'('+data.orgName+')');
				$('#project_owner').attr('readonly','readonly');
				$('#project_owner').parent().parent().append('<i class="sclose">x</i>');
				$('#projectowner').val(data.id);
			}
		});
		
		$('#projectowner').parent().delegate('.sclose','click',function(){
			$('#projectowner').val('');
			$(this).remove();
			$('#project_owner').removeAttr('readonly').val('');
		});	
	});
</script>
</head>
<body>
<div class="content">
	<form>
	<input type="hidden" name="id" value="${project.id }">
		<table width="100%">
			<tr>
				<td width="60">名称</td>
				<td><input type="text" name="name" class="long" value="${project.name }" check="required"/></td>
			</tr>
			<tr>
				<td width="120">负责人</td>
				<td><input id="projectowner" type="hidden" name="owner" value="${project.owner }" >
				<c:choose>
					<c:when test="${project.owner>0 }"><input type="text" readonly="readonly" id="project_owner" value="${owner.realName}"/><i class="sclose">x</i></c:when>
					<c:otherwise><input type="text" id="project_owner"/></c:otherwise>
				</c:choose>
				</td>
			</tr>
		</table>
		<input type="hidden" name="projectUsers" id="projectUsers">
	</form>
</div>
</body>
</html>